<%@page import="com.situ.web.entity.Teacher"%>
<%@page import="java.util.ArrayList"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<link rel="stylesheet" type="text/css"
	href="bootstrap-3.3.7-dist/css/bootstrap.css" />
<body>

	<%
		ArrayList<Teacher> list = (ArrayList<Teacher>) request.getAttribute("list");
	%>
	<table
		class="table table-striped table-bordered table-hover table-condensed">
		<tr>
			<th>ID</th>
			<th>名字</th>
			<th>年龄</th>
			<th>性别</th>
			<th>删除1</th>
			<th>删除2</th>
		</tr>
		<%
			for (Teacher teacher : list) {
		%>
		<tr>
			<td><%=teacher.getId()%></td>
			<td><%=teacher.getName()%></td>
			<td><%=teacher.getAge()%></td>
			<td><%=teacher.getGender()%></td>
			<td>
				<a href="javascript:void(0)"onclick="deleteById(<%=teacher.getId()%>)">删除</a>
			</td>
			<td>
				<a href="<%=request.getContextPath()%>/teacher?method=selectId&id=<%=teacher.getId()%>">修改</a>
			</td>
		</tr>

		<%
			}
		%>
	</table>
	<a class="btn btn-primary" style="margin: 0 auto" href="/Java1912Web/teacher_insert.jsp">新增</a>
	<script>
		function deleteById(id) {
			var isDel = confirm("确认是否删除");
			if(isDel){
				location.href= "<%=request.getContextPath()%>/teacher?method=deleteTeacher&id=" +id;
			//	location.href="/Java1912Web/student?method=deleteById&id=" +id;
			}
		}
	</script>
</body>
</html>